<template>
    <div>
        <el-form :model="addDirForm" ref="addDirRef" :rules="addDirFormRules">
            <el-form-item label="微信子商户号" prop="subMerchantNo">
                <el-input v-model="addDirForm.subMerchantNo"></el-input>
            </el-form-item>
            <el-form-item label="支付授权目录" prop="authPayDir">
                <el-input v-model="addDirForm.authPayDir"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="confirmAddDir(addDirForm)">确认</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
export default {
    props: {
        id: Number
    },
    data() {
        return {
            addDirForm: {},
            addDirFormRules: {
                subMerchantNo: [{ required: true, message: '请输入微信子商户号', trigger: 'blur' }],
                authPayDir: [{ required: true, message: '请输入支付授权目录', trigger: 'blur' }]
            }
        }
    },
    created() {

    },
    methods: {
        confirmAddDir(form) {
            let _this=this;
            this.$refs.addDirRef.validate((valid) => {
                if (valid) {
                    this.$axios({
                        url: '/admin/channel/other',
                        data: {
                            type: 1,
                            userID: _this.id,
                            genre: 8,
                            subMerchantNo:form.subMerchantNo,
                            authPayDir:form.authPayDir
                        },
                        success(res) {
                            if (res.data.code == 200) {
                                _this.$message({
                                    message:res.data.meg,
                                    type:'success'
                                });
                            }else{
                                _this.$message.error(res.data.msg);
                            }
                        }
                    });
                }
            });
        }
    }
}
</script>
<style scoped>
.el-input{
    width:200px;
}
</style>